package top.csy8888.likework.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.csy8888.likework.entity.User;
import top.csy8888.likework.mapper.UserMapper;
import top.csy8888.likework.service.UserService;

/**
 * @author CSY
 * @date 2025 - 10 - 12
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
    private final UserMapper userMapper;

    @Override
    public Integer login(User user) {
        User u = userMapper.login(user);
        if (u != null) {
            if (u.getPassword().equals(user.getPassword())) {
                // 登录成功后进行缓存预热
//                postOperationService.initAll(u.getUserId());
                return u.getUserId();
            }
        }
        return -1;
    }
}
